package com.aspose.cells;

import java.util.ArrayList;

public class Validation {
   private ValidationCollection d;
   private boolean e = true;
   private int f = 6;
   private int g = 1;
   private int h = 0;
   private String i;
   private String j;
   private String k;
   private String l;
   private boolean m = true;
   private boolean n = true;
   private boolean o = true;
   private String p;
   private String q;
   private boolean r = true;
   ArrayList a = new ArrayList();
   private int s = 0;
   byte[] b;
   byte[] c;

   Validation(ValidationCollection dvs) {
      this.d = dvs;
   }

   boolean a() {
      return this.e;
   }

   public int getOperator() {
      return this.f;
   }

   public void setOperator(int value) {
      this.f = value;
      if (this.f != 6) {
         this.e = false;
      }

   }

   public int getAlertStyle() {
      return this.g;
   }

   public void setAlertStyle(int value) {
      this.g = value;
      if (this.g != 1) {
         this.e = false;
      }

   }

   public int getType() {
      return this.h;
   }

   public void setType(int value) {
      this.h = value;
      if (this.h != 0) {
         this.e = false;
      }

   }

   public String getInputMessage() {
      return this.i;
   }

   public void setInputMessage(String value) {
      this.i = value;
      if (this.i != null && !"".equals(this.i)) {
         this.e = false;
      }

   }

   public String getInputTitle() {
      return this.j;
   }

   public void setInputTitle(String value) {
      this.j = value;
      if (this.j != null && !"".equals(this.j)) {
         this.e = false;
      }

   }

   public String getErrorMessage() {
      return this.k;
   }

   public void setErrorMessage(String value) {
      this.k = value;
      if (this.k != null && !"".equals(this.k)) {
         this.e = false;
      }

   }

   public String getErrorTitle() {
      return this.l;
   }

   public void setErrorTitle(String value) {
      this.l = value;
      if (this.l != null && !"".equals(this.l)) {
         this.e = false;
      }

   }

   public boolean getShowInput() {
      return this.m;
   }

   public void setShowInput(boolean value) {
      this.m = value;
      if (!value) {
         this.e = false;
      }

   }

   public boolean getShowError() {
      return this.n;
   }

   public void setShowError(boolean value) {
      this.n = value;
      if (!value) {
         this.e = false;
      }

   }

   public boolean getIgnoreBlank() {
      return this.o;
   }

   public void setIgnoreBlank(boolean value) {
      this.o = value;
      if (!value) {
         this.e = false;
      }

   }

   public String getFormula1() {
      return this.p;
   }

   public void setFormula1(String value) {
      this.b = null;
      this.p = value;
      if (value != null && !"".equals(value)) {
         this.e = false;
      }

   }

   public Object getValue1() {
      if (this.b == null) {
         byte var1 = 0;
         byte var2 = 0;
         int[] var3 = new int[]{var1};
         int[] var4 = new int[]{var2};
         this.a(var3, var4);
         int var5 = var3[0];
         int var7 = var4[0];
      }

      byte[] var6 = this.d();
      if (var6 != null) {
         Object var8 = a(this, this.d.a().c(), var6, 0, this.getType());
         if (var8 != null) {
            return var8;
         }
      }

      return this.getFormula1();
   }

   public void setValue1(Object value) {
      this.b = this.a(value);
      if (this.b == null) {
         this.setFormula1(com.aspose.cells.b.a.zr.a(value));
      } else {
         this.p = com.aspose.cells.b.a.zr.a(value);
      }

   }

   public Object getValue2() {
      if (this.c == null) {
         byte var1 = 0;
         byte var2 = 0;
         int[] var3 = new int[]{var1};
         int[] var4 = new int[]{var2};
         this.a(var3, var4);
         int var5 = var3[0];
         int var7 = var4[0];
      }

      byte[] var6 = this.e();
      if (var6 != null) {
         Object var8 = a(this, this.d.a().c(), var6, 0, this.getType());
         if (var8 != null) {
            return var8;
         }
      }

      return this.getFormula2();
   }

   public void setValue2(Object value) {
      this.c = this.a(value);
      if (this.c == null) {
         this.setFormula2(com.aspose.cells.b.a.zr.a(value));
      } else {
         this.q = com.aspose.cells.b.a.zr.a(value);
      }

   }

   byte[] a(Object var1) {
      var1 = zapb.a(var1, this.d.a().c().n().getSettings().getDate1904());
      double var2 = 0.0D;
      if (var1 != null) {
         var2 = (Double)var1;
         Object var4 = null;
         switch(this.getType()) {
         case 1:
         case 2:
         case 4:
         case 5:
         case 6:
            byte[] var6;
            if (Math.abs(var2 - (double)((int)var2)) < Double.MIN_VALUE) {
               int var5 = (int)var2;
               if (var5 <= 65535 && var5 >= 0) {
                  var6 = new byte[]{30, 0, 0};
                  System.arraycopy(com.aspose.cells.b.a.zc.a(var5), 0, var6, 1, 2);
               } else {
                  var6 = new byte[9];
                  var6[0] = 31;
                  System.arraycopy(com.aspose.cells.b.a.zc.a(var2), 0, var6, 1, 8);
               }
            } else {
               var6 = new byte[9];
               var6[0] = 31;
               System.arraycopy(com.aspose.cells.b.a.zc.a(var2), 0, var6, 1, 8);
            }

            return var6;
         case 3:
         default:
            return null;
         }
      } else {
         return null;
      }
   }

   public String getFormula2() {
      return this.q;
   }

   public void setFormula2(String value) {
      this.c = null;
      this.q = value;
      if (value != null && !"".equals(value)) {
         this.e = false;
      }

   }

   void a(String var1) {
      this.p = var1;
   }

   void b(String var1) {
      this.q = var1;
   }

   public boolean getInCellDropDown() {
      return this.r;
   }

   public void setInCellDropDown(boolean value) {
      this.r = value;
      if (!value) {
         this.e = false;
      }

   }

   int[] b() {
      if (this.a != null && this.a.size() != 0) {
         CellArea var1 = (CellArea)this.a.get(0);
         return new int[]{var1.StartRow, var1.StartColumn};
      } else {
         return null;
      }
   }

   public ArrayList getAreaList() {
      return this.a;
   }

   public void addArea(CellArea cellArea) {
      this.d.a(cellArea, this);
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)cellArea);
   }

   public void removeArea(CellArea cellArea) {
      if (this.a != null && this.a.size() != 0) {
         for(int var2 = this.a.size() - 1; var2 >= 0; --var2) {
            CellArea var3 = (CellArea)this.a.get(var2);
            boolean var4 = false;
            boolean[] var5 = new boolean[]{var4};
            CellArea var6 = a(cellArea, var3, var5);
            var4 = var5[0];
            if (!var4) {
               CellArea var7;
               if (var6.StartRow > var3.StartRow) {
                  var7 = new CellArea();
                  var7.StartRow = var3.StartRow;
                  var7.EndRow = var6.StartRow - 1;
                  var7.StartColumn = var3.StartColumn;
                  var7.EndColumn = var3.EndColumn;
                  com.aspose.cells.b.a.a.ze.a(this.a, (Object)var7);
               }

               if (var6.EndRow < var3.EndRow) {
                  var7 = new CellArea();
                  var7.StartRow = var6.EndRow + 1;
                  var7.EndRow = var3.EndRow;
                  var7.StartColumn = var3.StartColumn;
                  var7.EndColumn = var3.EndColumn;
                  com.aspose.cells.b.a.a.ze.a(this.a, (Object)var7);
               }

               var3.StartRow = var6.StartRow;
               var3.EndRow = var6.EndRow;
               if (var6.StartColumn > var3.StartColumn) {
                  var7 = new CellArea();
                  var7.StartRow = var3.StartRow;
                  var7.EndRow = var3.EndRow;
                  var7.StartColumn = var3.StartColumn;
                  var7.EndColumn = var6.StartColumn - 1;
                  com.aspose.cells.b.a.a.ze.a(this.a, (Object)var7);
               }

               if (var6.EndColumn < var3.EndColumn) {
                  var7 = new CellArea();
                  var7.StartRow = var3.StartRow;
                  var7.EndRow = var3.EndRow;
                  var7.StartColumn = var6.EndColumn + 1;
                  var7.EndColumn = var3.EndColumn;
                  com.aspose.cells.b.a.a.ze.a(this.a, (Object)var7);
               }

               this.a.remove(var2);
            }
         }

      }
   }

   static CellArea a(CellArea var0, CellArea var1, boolean[] var2) {
      CellArea var3 = new CellArea();
      var3.StartRow = var0.StartRow < var1.StartRow ? var1.StartRow : var0.StartRow;
      var3.StartColumn = var0.StartColumn < var1.StartColumn ? var1.StartColumn : var0.StartColumn;
      var3.EndRow = var0.EndRow < var1.EndRow ? var0.EndRow : var1.EndRow;
      var3.EndColumn = var0.EndColumn < var1.EndColumn ? var0.EndColumn : var1.EndColumn;
      var2[0] = var3.StartRow > var3.EndRow || var3.StartColumn > var3.EndColumn;
      return var3;
   }

   public void removeACell(int row, int column) {
      if (this.a != null && this.a.size() != 0) {
         int var3 = this.a.size();

         for(int var4 = var3 - 1; var4 >= 0; --var4) {
            CellArea var5 = (CellArea)this.a.get(var4);
            if (row >= var5.StartRow && row <= var5.EndRow && column >= var5.StartColumn && column <= var5.EndColumn) {
               CellArea var6;
               if (row > var5.StartRow) {
                  var6 = new CellArea();
                  var6.StartRow = var5.StartRow;
                  var6.EndRow = row - 1;
                  var6.StartColumn = var5.StartColumn;
                  var6.EndColumn = var5.EndColumn;
                  com.aspose.cells.b.a.a.ze.a(this.a, (Object)var6);
               }

               if (row < var5.EndRow) {
                  var6 = new CellArea();
                  var6.StartRow = row + 1;
                  var6.EndRow = var5.EndRow;
                  var6.StartColumn = var5.StartColumn;
                  var6.EndColumn = var5.EndColumn;
                  com.aspose.cells.b.a.a.ze.a(this.a, (Object)var6);
               }

               var5.StartRow = row;
               var5.EndRow = row;
               if (column > var5.StartColumn) {
                  var6 = new CellArea();
                  var6.StartRow = row;
                  var6.EndRow = row;
                  var6.StartColumn = var5.StartColumn;
                  var6.EndColumn = column - 1;
                  com.aspose.cells.b.a.a.ze.a(this.a, (Object)var6);
               }

               if (column < var5.EndColumn) {
                  var6 = new CellArea();
                  var6.StartRow = row;
                  var6.EndRow = row;
                  var6.StartColumn = column + 1;
                  var6.EndColumn = var5.EndColumn;
                  com.aspose.cells.b.a.a.ze.a(this.a, (Object)var6);
               }

               this.a.remove(var4);
            }
         }

      }
   }

   void a(int var1, int var2, Worksheet var3) {
      if (this.a != null && this.a.size() != 0) {
         byte var4 = 0;
         byte var5 = 0;
         int[] var6 = new int[]{var5};
         int[] var7 = new int[]{var4};
         this.a(var6, var7);
         int var16 = var6[0];
         int var15 = var7[0];
         int var8 = 1048575;
         int var9 = 0;

         for(int var10 = this.a.size() - 1; var10 >= 0; --var10) {
            CellArea var11 = (CellArea)this.a.get(var10);
            if (var11.EndColumn + 1 == var1 && var2 > 0) {
               var11.EndColumn += var2;
               this.a.set(var10, var11);
            } else {
               boolean var12 = false;
               boolean[] var13 = new boolean[]{var12};
               CellArea var14 = zayd.b(var11, var1, var2, var13);
               var12 = var13[0];
               if (var12) {
                  this.a.remove(var10);
               } else {
                  this.a.set(var10, var14);
                  if (var14.StartRow < var8) {
                     var8 = var14.StartRow;
                     var9 = var14.StartColumn;
                  }
               }
            }
         }

         if (this.a.size() != 0) {
            byte[] var17 = this.d();
            if (var17 != null) {
               zyo.c(var3, true, var1, var2, var15, var9, 0, var17.length - 1, var17);
               this.p = a(var3.c(), var17, 0, this.getType(), var8, var9);
            }

            var17 = this.e();
            if (var17 != null) {
               zyo.c(var3, true, var1, var2, var15, var9, 0, var17.length - 1, var17);
               this.q = a(var3.c(), var17, 0, this.getType(), var8, var9);
            }

         }
      }
   }

   void b(int var1, int var2, Worksheet var3) {
      if (this.a != null && this.a.size() != 0) {
         byte var4 = 0;
         byte var5 = 0;
         int[] var6 = new int[]{var4};
         int[] var7 = new int[]{var5};
         this.a(var6, var7);
         int var14 = var6[0];
         int var15 = var7[0];
         int var8 = 1048575;
         int var9 = 0;

         for(int var10 = this.a.size() - 1; var10 >= 0; --var10) {
            CellArea var11 = (CellArea)this.a.get(var10);
            boolean var12 = false;
            if (var2 > 0 && var1 == var11.EndRow + 1) {
               var11.EndRow = var1 + var2 - 1;
            } else {
               boolean[] var13 = new boolean[]{var12};
               var11 = zayd.a(var11, var1, var2, var13);
               var12 = var13[0];
            }

            if (var12) {
               this.a.remove(var10);
            } else {
               this.a.set(var10, var11);
               if (var11.StartRow < var8) {
                  var8 = var11.StartRow;
                  var9 = var11.StartColumn;
               }
            }
         }

         if (this.a.size() != 0) {
            byte[] var16 = this.d();
            if (var16 != null) {
               zyo.a(var3, true, var1, var2, var14, var8, 0, var16.length - 1, var16);
               this.p = a(var3.c(), var16, 0, this.getType(), var8, var9);
            }

            var16 = this.e();
            if (var16 != null) {
               zyo.a(var3, true, var1, var2, var14, var8, 0, var16.length - 1, var16);
               this.q = a(var3.c(), var16, 0, this.getType(), var8, var9);
            }

         }
      }
   }

   int c() {
      return this.s;
   }

   void a(int var1) {
      this.s = var1;
   }

   byte[] d() {
      return this.b;
   }

   void a(byte[] var1) {
      this.b = var1;
   }

   byte[] e() {
      return this.c;
   }

   void b(byte[] var1) {
      this.c = var1;
   }

   void a(Validation var1) {
      this.g = var1.g;
      this.k = var1.k;
      this.l = var1.l;
      this.p = var1.p;
      this.q = var1.q;
      this.o = var1.o;
      this.s = var1.s;
      this.r = var1.r;
      this.i = var1.i;
      this.j = var1.j;
      this.e = var1.e;
      this.f = var1.f;
      this.n = var1.n;
      this.m = var1.m;
      this.h = var1.h;
      this.a.clear();
   }

   void a(Validation var1, CopyOptions var2) {
      this.g = var1.g;
      this.k = var1.k;
      this.l = var1.l;
      this.p = var1.p;
      this.q = var1.q;
      this.o = var1.o;
      this.s = var1.s;
      this.r = var1.r;
      this.i = var1.i;
      this.j = var1.j;
      this.e = var1.e;
      this.f = var1.f;
      this.n = var1.n;
      this.m = var1.m;
      this.h = var1.h;
      this.a.clear();

      for(int var3 = 0; var3 < var1.a.size(); ++var3) {
         CellArea var4 = (CellArea)var1.a.get(var3);
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)CellArea.c(var4));
      }

   }

   void a(Validation var1, CellArea var2, Worksheet var3, CopyOptions var4) {
      this.g = var1.g;
      this.k = var1.k;
      this.l = var1.l;
      this.o = var1.o;
      this.s = var1.s;
      this.r = var1.r;
      this.i = var1.i;
      this.j = var1.j;
      this.e = var1.e;
      this.f = var1.f;
      this.n = var1.n;
      this.m = var1.m;
      this.h = var1.h;
      this.a.clear();
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var2);
      WorksheetCollection var5 = var1.d.a().c();
      WorksheetCollection var6 = this.d.a().c();
      if (var5 != var6) {
         if (var1.b != null) {
            this.setFormula1(a(var5, var1.b, 0, this.getType(), var2.StartRow, var2.StartColumn));
         }

         if (var1.c != null) {
            this.setFormula2(a(var5, var1.c, 0, this.getType(), var2.StartRow, var2.StartColumn));
         }
      } else {
         if (var1.b != null) {
            this.b = zyd.a(var5, var6, var1.b, 0, var2.StartRow, var2.StartColumn);
            this.p = a(var3.c(), this.b, 0, this.getType(), var2.StartRow, var2.StartColumn);
         }

         if (var1.c != null) {
            this.c = zyd.a(var5, var6, var1.c, 0, var2.StartRow, var2.StartColumn);
            this.q = a(var3.c(), this.c, 0, this.getType(), var2.StartRow, var2.StartColumn);
         }
      }

   }

   boolean f() {
      WorksheetCollection var1 = this.d.a().c();
      byte[] var2 = this.b;
      if (var2 != null && zyo.a(var1, var2, 0, var2.length - 1)) {
         return true;
      } else {
         if ((this.getOperator() == 0 || this.getOperator() == 7) && this.c != null) {
            var2 = this.c;
            if (var2 != null && zyo.a(var1, var2, 0, var2.length - 1)) {
               return true;
            }
         }

         return false;
      }
   }

   void a(int[] var1, int[] var2) {
      Worksheet var3 = this.d.a();
      if (var3.c().n().k()) {
         zbuq var4 = new zbuq(var3);
         var4.a(this);
         var1[0] = var4.a();
         var2[0] = var4.b();
      } else {
         zbup var5 = new zbup(var3);
         var5.a(this);
         var1[0] = var5.a();
         var2[0] = var5.b();
      }

   }

   void a(String var1, String var2) {
      Worksheet var3 = this.d.a();
      byte var4 = 0;
      byte var5 = 0;
      this.p = var1;
      this.q = var2;
      int[] var6 = new int[]{var4};
      int[] var7 = new int[]{var5};
      this.a(var6, var7);
      int var8 = var6[0];
      int var9 = var7[0];
      if (this.b != null && zyo.a(var3.c(), this.b, 0, false)) {
         this.p = a(var3.c(), this.b, 0, this.h, var8, var9);
      }

      if (this.c != null && zyo.a(var3.c(), this.c, 0, false)) {
         this.q = a(var3.c(), this.c, 0, this.h, var8, var9);
      }

   }

   static Object a(Validation var0, WorksheetCollection var1, byte[] var2, int var3, int var4) {
      if (var2.length == 0) {
         return null;
      } else if (var4 == 3) {
         Cell var8 = null;
         if (var0.a.size() > 0) {
            CellArea var9 = (CellArea)var0.a.get(0);
            var8 = var0.d.a().getCells().get(var9.StartRow, var9.StartColumn);
         }

         return zbur.a(var0, var1, var8);
      } else {
         Object var5 = zyo.a(var1, var2, var3);
         if (var5 != null) {
            switch(var4) {
            case 1:
            case 2:
            case 4:
            case 5:
            case 6:
               double var6 = 0.0D;
               if (var5 instanceof Integer) {
                  var6 = (double)(Integer)var5;
               } else {
                  if (!(var5 instanceof Double)) {
                     return var5;
                  }

                  var6 = (Double)var5;
               }

               switch(var4) {
               case 1:
               case 6:
                  return (int)var6;
               case 2:
                  return var6;
               case 3:
               default:
                  return var5;
               case 4:
               case 5:
                  return CellsHelper.getDateTimeFromDouble(var6, var1.n().getSettings().getDate1904());
               }
            case 3:
            }
         }

         return var5;
      }
   }

   static String a(WorksheetCollection var0, byte[] var1, int var2, int var3, int var4, int var5) {
      if (var1.length == 0) {
         return null;
      } else {
         try {
            zyf var6 = var0.b();
            String var8 = var6.a(0, var1, var4, var5, true);
            String var9;
            double var10;
            switch(var3) {
            case 3:
               if (zyp.a(var0, var1, var2)) {
                  if (var8.indexOf("\"\"") == -1) {
                     var8 = var8.substring(2, 2 + (var8.length() - 3));
                  } else {
                     var8 = var8.substring(1);
                  }

                  var8 = var8.replace('\u0000', ',');
               }
               break;
            case 4:
               var9 = var8.substring(1);
               if (zapb.b(var9)) {
                  var10 = com.aspose.cells.b.a.zn.a(var9, com.aspose.cells.b.a.c.za.b());
                  DateTime var16 = CellsHelper.getDateTimeFromDouble(var10, var0.n().getSettings().getDate1904());
                  String var17 = com.aspose.cells.b.a.zo.a(var16.getYear()) + "-" + com.aspose.cells.b.a.zo.a(var16.getMonth()) + "-" + com.aspose.cells.b.a.zo.a(var16.getDay());
                  if (var16.getHour() == 0 && var16.getMinute() == 0 && var16.getSecond() == 0) {
                     var8 = var17;
                  } else {
                     var8 = var17 + " " + com.aspose.cells.b.a.zo.a(var16.getHour()) + ":" + com.aspose.cells.b.a.zo.a(var16.getMinute()) + ":" + com.aspose.cells.b.a.zo.a(var16.getSecond());
                  }
               }
               break;
            case 5:
               var9 = var8.substring(1);
               if (zapb.b(var9)) {
                  var10 = 86400.0D * com.aspose.cells.b.a.zn.a(var9, com.aspose.cells.b.a.c.za.b());
                  int var12 = (int)var10 / 3600;
                  int var13 = (int)(var10 - (double)(var12 * 3600)) / 60;
                  int var14 = (int)(var10 - (double)(var12 * 3600) - (double)(var13 * 60));
                  var8 = com.aspose.cells.b.a.zo.a(var12) + ":" + com.aspose.cells.b.a.zo.a(var13) + ":" + com.aspose.cells.b.a.zo.a(var14);
               }
            }

            return var8;
         } catch (Exception var15) {
            return null;
         }
      }
   }
}
